package tt.dz.egobus.servicemanager.facade.order;

import com.alibaba.dubbo.config.annotation.Reference;
import tt.dz.egobus.api.ResponseBack;
import tt.dz.egobus.api.page.Page;
import tt.dz.egobus.api.page.Pageable;
import tt.dz.egobus.bean.comment.TagBack;
import tt.dz.egobus.bean.comment.TagRequest;
import tt.dz.egobus.bean.orderSn.OrderSnBack;
import tt.dz.egobus.service.comment.TagApiService;
import tt.dz.egobus.service.orderSn.OrderSnApiService;
import tt.dz.egobus.servicemanager.facade.interator.Facade;

import java.util.List;


/**
 * @author Anson
 * @date 17-3-28
 * @name 订单中心api依赖facade
 * @since 1.0.3
 */
@Facade(facadeName = "order")
public class OrderFacade {

    @Reference(version = "1.0.3", timeout = 10000)
    private OrderSnApiService orderSnApiService;

    @Reference(version = "1.0.6", timeout = 10000)
    private TagApiService tagApiService;


    public ResponseBack<Boolean> verifyOrderServeNumber(int businessCode) {
        return this.orderSnApiService.verifyOrderServeNumber(businessCode);
    }


    public ResponseBack<OrderSnBack> queryOrderServeNumber(int businessCode) {
        return this.orderSnApiService.queryOrderServeNumber(businessCode);
    }


    public ResponseBack<List<OrderSnBack>> queryAllOrderServeNumber() {
        return this.orderSnApiService.queryAllOrderServeNumber();
    }


    /**
     * 添加订单评论标签
     *
     * @param request 添加标签的请求参数
     * @return 添加成功后的标签
     * @date 2017-08-10
     * @since 1.0.6
     */
    public ResponseBack<TagBack> addTag(TagRequest request) {
        return tagApiService.addTag(request);
    }

    /**
     * 根据不同的星级获取不同的标签
     *
     * @param starLevel 评论的星级
     * @return 不同的标签
     * @date 2017-08-10
     * @since 1.0.6
     */
    public ResponseBack<List<TagBack>> getTagByLevel(int starLevel) {
        return tagApiService.getTagByLevel(starLevel);
    }

    /**
     * 修改评论标签
     *
     * @param tagId 标签的id
     * @param value 标签的值
     * @return 修改后的标签
     */
    public ResponseBack<TagBack> updateTag(String tagId, String value) {
        return tagApiService.updateTag(tagId, value);
    }

    /**
     * 根据id删除评论的标签
     *
     * @param tagId 标签的id
     * @return
     * @date 20107-08-10
     * @since 1.0.6
     */
    public ResponseBack<Boolean> deleteTag(String tagId) {
        return tagApiService.deleteTag(tagId);
    }

    /**
     * 分页获取标签
     *
     * @param pageable 分页过滤器
     * @return
     * @date 2017-08-11
     * @since 1.0.6
     */
    public ResponseBack<Page<TagBack>> queryPage(Pageable pageable) {
        return tagApiService.queryPage(pageable);
    }
}
